package com.ccsu.eb.service;

import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ccsu.eb.mapper.EbCommentMapper;
import com.ccsu.eb.model.EbComment;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Description: 用一句话描述
 * @Auther: 新梦想*陈超
 * @Date: 2022/3/18 14:08
 */
@Service
public class EbCommentService {
    @Resource
    private EbCommentMapper ebCommentMapper;
    /**
     * 分页查询新闻信息，按时间降序
     * @param pnum
     * @return
     */
    public Page list(Integer pnum){

        Page<EbComment> page = new Page<>(pnum,5);
        page.addOrder(OrderItem.desc("ec_create_time"));//时间降序
        Page<EbComment> ebCommentPage = ebCommentMapper.selectPage(page, null);
        if(ebCommentPage==null){
            //TODO  异常 进行处理
        }
        return ebCommentPage;
    }
}
